﻿@using Partner.Surround.Web.Startup
@using Partner.Surround.Authorization
@{
    ViewBag.CurrentPageName = PageNames.Permissions;
}

<!--权限列表-->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-row">
                <div class="layui-col-xs12">
                    <table class="layui-table"
                           lay-data="{height: 'full-65', page:true, id:'permissionList'}"
                           lay-filter="permissionList">
                        <thead>
                            <tr>
                                <th lay-data="{field:'name'}">权限名称</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

@section scripts{
    <script type="text/javascript">
        layui.config({
            base: '/lib/layui-extend-modules/' //静态资源所在路径
        }).use(['jquery', 'layer', 'table'], function () {
            var $ = layui.$,
                table = layui.table;

            //主列表加载，可反复调用进行刷新
            var config = {};  //table的参数，如搜索key，点击tree的id
            var loadPermissionList = function (options) {
                if (options != undefined) {
                    $.extend(config, options);
                }
                table.reload('permissionList', {
                    url: "@Url.Action("GetPermissionList", "Permissions")",
                    where: config,
                    parseData: function (res) {
                        return {
                            "code": res.result.code, //解析接口状态
                            "msg": res.result.msg, //解析提示文本
                            "count": res.result.count, //解析数据长度
                            "data": res.result.data //解析数据列表
                        };
                    },
                    response: {
                        statusCode: 200 //规定成功的状态码，默认：0
                    }
                });
            };
            loadPermissionList(); 
        });
    </script>
}

